@extends('backend::layout')
@section('title',$page_title)
@section('content')
    @component('backend::component.tpl_frame')
        @slot('page_title') {!! $breadcrumbs !!} @endslot
        @slot('icon') hcl-city @endslot
        @slot('tools_btn')
            @component('backend::component.form.button')
                @slot('title') 导出json文件 @endslot
                @slot('elem') a @endslot
                @slot('href') {{route('b_Area_exportAreaFile')}} @endslot
                @slot('icon') hcl-export @endslot
                @slot('class')   @endslot
            @endcomponent
            @component('backend::component.form.button')
                @slot('title') 添加地区 @endslot
                @slot('elem') a @endslot
                @slot('color') info @endslot
                @slot('href') {{route('b_Area_addArea',['parent_id'=>$parent_id])}} @endslot
                @slot('icon') hcl-add-page @endslot
                @slot('class') modal-box  @endslot
                @slot('params') {"title":"{{$page_title}}","area":"600,500"} @endslot
            @endcomponent
        @endslot
        @slot('body_content')
                @foreach($list as $item)
                    <div class="alert alert-primary mb-2 d-inline-block mw-100">
                    <div class="d-inline-flex justify-content-start align-items-center" style="width: 150px;">
                        <span class="alert-icon mr-05"><i class="hcl hcl-city"></i></span>
                        <a href="@if($item['level']<3) {{route('b_Area_showArea',['parent_id'=>$item['id']])}} @else #{{$item['id']}} @endif">
                            <strong>{{$item['name']}}</strong>
                        </a>

                    </div>
                    <div class="d-inline-flex justify-content-end">
                        <button type="button" class="btn btn-xs btn-outline-danger ml-1 modal-box"
                                href="{{route('b_Area_editArea',['id'=>$item['id']])}}"
                                data-params='{"title":"编辑{{$item['name']}}","area":"600,500"}'
                        ><i class="hcl hcl-edit"></i></button>
                        <button type="button"
                                class="btn btn-xs btn-outline-danger ml-1 btn-ajax"
                                data-params='{"url":"{{route('b_Area_deleteArea',['id'=>$item['id']])}}","confirm":true}'
                        ><i class="hcl hcl-remove"></i>
                        </button>
                        @if($item['level']<3)
                            <a href="{{route('b_Area_addArea',['parent_id'=>$item['id']])}}"
                               class="btn btn-xs btn-outline-danger ml-1 modal-box"
                               data-params='{"title":"添加{{$item['name']}}的下级行政地区","area":"600,500"}'
                            ><i class="hcl hcl-add-page"></i></a>
                        @endif
                    </div>
                </div>
                @endforeach
        @endslot
    @endcomponent
@endsection